package com.pethospital.entity;

import java.sql.Timestamp;

/**
 * 用户实体类
 * User Entity Class
 * 
 * @author PetHospital System
 * @version 1.0
 */
public class User {
    
    private Integer userId;          // 用户ID
    private String username;         // 用户名
    private String password;         // 密码
    private String realName;         // 真实姓名
    private String phone;            // 电话号码
    private String email;            // 邮箱
    private String address;          // 地址
    private String userType;         // 用户类型：admin-管理员，user-普通用户
    private String status;           // 状态：active-激活，inactive-禁用
    private Timestamp createTime;    // 创建时间
    private Timestamp updateTime;    // 更新时间

    /**
     * 默认构造函数
     */
    public User() {
    }

    /**
     * 带参构造函数
     */
    public User(String username, String password, String realName, String phone, String email, String userType) {
        this.username = username;
        this.password = password;
        this.realName = realName;
        this.phone = phone;
        this.email = email;
        this.userType = userType;
        this.status = "active";
    }

    // Getter和Setter方法
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * 判断是否为管理员
     */
    public boolean isAdmin() {
        return "admin".equals(this.userType);
    }

    /**
     * 判断是否为激活状态
     */
    public boolean isActive() {
        return "active".equals(this.status);
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", username='" + username + '\'' +
                ", realName='" + realName + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", userType='" + userType + '\'' +
                ", status='" + status + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
